<div class="da-list-wrap">
  <div class="da-content-banner">
    <d-breadcrumb>
      <d-breadcrumb-item><a routerLink="/">{{ 'basicdata.breadcrumb.home' | translate }}</a></d-breadcrumb-item>
      <d-breadcrumb-item>{{ 'basicdata.breadcrumb.position' | translate }}</d-breadcrumb-item>
    </d-breadcrumb>
  </div>
<div class="da-content-wrapper">


          <div class="departments">
            <div class="card">
              <div class="card-title">
                <span>仓库列表</span>
              </div>
              <div class="fitter mt-3">
                <input dTextInput placeholder="请输入" name="searchDepartmentValue" (input)="searchWarehouse($event)" />
              </div>
              <div class="card-body">
                <d-tree  #basicTree  [tree]="displayTreeData" [treeNodeIdKey]="'warehouseId'"   [treeNodeTitleKey]="'warehouseName'"   (afterTreeInit)="afterTreeInit($event)"
                (nodeSelected)="nodeSelected($event)"
                 >
                </d-tree>
              </div>
            </div>
          </div>
          <div class="employs-box">
            <div class="card">
              <div class="card-header">
                <div>
                  <div class="d-input">
                    <input dTextInput style="width: 150px;"  [error]="false" placeholder="仓位名称" [(ngModel)]="SearchTerm" name="SearchTerm">
                    <d-select  [options]="selectoptions" [(ngModel)]="selectvalue" (valueChange)="selctChange()" style="width: 150px; height: 33px; margin-left: 5px;"></d-select>
                  </div>
                  <d-button id="primaryBtn"  (click)="search()"><i class="icon icon-filter-o me-2" ></i>查询</d-button>
                  <d-button bsStyle="common" (btnClick)=" reset()"> <i class="icon icon-refresh me-2"></i>重置</d-button>
                </div>
                </div>
                <div class="btn-group">
                  <d-button bsStyle="primary" (btnClick)="creatPositon()"> <i class="icon icon-add me-2"></i>新增</d-button>
                  <d-button bsStyle="success" (btnClick)="enable()"><i class="icon icon-right me-2"></i>启用</d-button>
                  <d-button bsStyle="warning" (btnClick)="disable()"><i class="icon icon-error me-2"></i>禁用</d-button>
                  <d-button bsStyle="danger" (click)="deletes()"><i class="icon icon-delete me-2"></i>删除</d-button>
                  <div class="dDropDown" dDropDown [trigger]="'hover'">
                    <input type="file" #fileInput1 style="display: none" (change)="onFileSelected($event)">
                    <d-button bsStyle="common" class="devui-dropdown-origin" (btnClick)="onButtonClick()">
                      导入
                      <span class="icon-select-arrow"></span>
                    </d-button>
                    <ul dDropDownMenu class="devui-dropdown-menu devui-scrollbar" role="menu">
                      <li role="menuitem">
                        <a dDropDownMenuItem (click)="downloadPositionFileModel()">下载模板</a>
                      </li>
                    </ul>
                  </div>
                  <d-button bsStyle="common" (btnClick)="DownloadFile()"> <i class="icon icon-merge me-2"></i>导出</d-button>
              </div>

                <div class="list-content">
                <d-data-table [lazy]="true" [dataSource]="displayTableData"
                [scrollable]="true" [fixHeader]="true" [resizeable]="true" [tableWidthConfig]="tableWidthConfig" (checkAllChange)="getCheckedRows()" (rowCheckChange)="getCheckedRows()" [tableOverflowType]="'auto'" [scrollable]="true" [resizeable]="true" [colDraggable]="true" >
                  <thead dTableHead [checkable]="true" >
                    <tr dTableRow >
                      <th dHeadCell [fixedLeft]="'80px'" >
                        操作
                      </th>
                      <th dHeadCell  *ngFor="let colOption of dataTableOptions.columns">{{ colOption.header }}</th>
                    </tr>
                  </thead>
                  <tbody dTableBody>
                    <ng-template let-rowItem="rowItem" let-rowIndex="rowIndex" let-nestedIndex="nestedIndex">
                      <tr dTableRow>
                        <td dTableCell [fixedLeft]="'0px'" >
                          <d-checkbox [disabled]="false" [showAnimation]="true" [showGlowStyle]="false"
                          [ngModelOptions]="{ standalone: true }" [ngModel]="rowItem.$checked" dTooltip
                          (ngModelChange)="onRowCheckChange($event, rowIndex, nestedIndex, rowItem)"
                          ></d-checkbox>
                        </td>
                        <td dTableCell [fixedLeft]="'80px'">
                          <span class="me-2"(click)="edit(rowItem)" ><a class="devui-link">编辑</a></span>
                          <span (click)="delete(rowItem.positionId)"><a class="devui-link-danger">删除</a></span>
                        </td>
                        <td dTableCell [rowItem]="rowItem" >
                          <span dTooltip [content]="rowItem?.positionNum">{{rowItem?.positionNum}}</span>
                        </td>
                        <td dTableCell [rowItem]="rowItem" >
                          <span dTooltip [content]="rowItem?.positionName">{{rowItem?.positionName}}</span>
                        </td>
                        <td dTableCell [rowItem]="rowItem" [field]="'showType'">
                          <span>
                            <div dImagePreview>
                              <d-badge *ngIf="rowItem.qrCode" [count]="getImagesArray2(rowItem.qrCode).length" status="success">
                                <ng-container *ngFor="let imageUrl of getImagesArray2(rowItem.qrCode); let i = index">
                                  <img *ngIf="getImagesArray2(rowItem.qrCode).length > 0" [src]="imageUrl" alt="图片" height="22px" [ngStyle]="{'display': i === 0 ? 'block' : 'none'}" />
                                </ng-container>
                              </d-badge>
                            </div>
                          </span>
                        </td>
                        <td dTableCell [rowItem]="rowItem">
                          <span dTooltip [content]="rowItem?.isEnabled | status"><d-tag [tag]=" rowItem?.isEnabled | status" [labelStyle]="rowItem?.isEnabled" ></d-tag></span>
                        </td>
                      </tr>
                    </ng-template>
                  </tbody>
                </d-data-table>
                </div>
                  <div class="page-footer">
                    <div>
                      <p>已选 <span class="underline">{{deleteIDs.length}}</span> 条
                        <a (click)="cleared()">清空</a>
                      </p>
                    </div>
                    <d-pagination
                    [size]="'sm'"
                    [canViewTotal]="true"
                    [canChangePageSize]="true"
                    [canJumpPage]="true"
                    [maxItems]="5"
                    [total]="this.pager.total"
                    [pageSizeOptions]="this.pageSizeOptions"
                    [(pageSize)]="pager.pageSize"
                    [(pageIndex)]="pager.pageIndex"
                    (pageIndexChange)="pageIndexChange($event)"
                    (pageSizeChange)="pageSizeChange($event)"
                    >
                  </d-pagination>
                  </div>


            </div>
          </div>


</div>
</div>
<d-toast [value]="msgs" [life]="2000" [styleClass]="'custom-class'" [style]="{ left: '50%',top:'10px' }"></d-toast>
